<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>潜在客户呼叫记录列表</title>
    <meta name="decorator" content="default"/>
    <link rel="stylesheet" href="${ctxStatic}/bootstrap-table/bootstrap-table.css">
    <script src="${ctxStatic}/bootstrap-table/bootstrap-table.js"></script>
    <script src="${ctxStatic}/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <script src="${ctxStatic}/bootstrap-table/config.js"></script>
    <script src="${ctxStatic}/common/player.js"></script>
</head>
<body>
	<ul class="nav nav-tabs">
	    <!--默认不跳转-->
		<li class="active"><a href="javascript:void(0);">潜在客户呼叫记录列表</a></li>
	</ul>
    <table id="soundTable" data-url="${ctx}/customer/potentialCall/listAjaxData">
        <thead>
        <tr>
            <th data-field="serviceDirect" data-align="center" data-formatter="serviceDirectFormat">呼叫类型</th>
            <th data-field="toPhone" data-align="center">呼叫号码</th>
            <th data-field="startDate" data-sortable="true" data-align="center">接通时间</th>
            <th data-field="endDate" data-sortable="true"  data-align="center">挂断时间</th>
            <th data-field="alertTime"  data-align="center">振铃时长</th>
            <th data-field="callTime" data-sortable="true"  data-align="center">通话时长</th>
            <th data-field="fromUserName" data-sortable="true"  data-align="center">坐席人员</th>
            <th data-field="disconnectType"  data-align="center" data-formatter="disconnectTypeFormat">挂机方式</th>
            <th data-align="center" data-events="operateEvents" data-formatter="callOperation">操作</th>
        </tr>
        </thead>
    </table>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#soundTable").bootstrapTable(
                $.fn.BTConfigSimple({//不做分页 直接用list的方法
                    pagination: false,
                    sidePagination:'client',
                    sortName:"startDate",
                    responseHandler: function (res) {
                        return res;
                    },
                    userQuery:function(){
                        return {potentialCustomerId:"IMPORT2015090117113652382"};
                    }
                }));
        });

        function serviceDirectFormat(value, row, index){
            if(row.serviceDirect=="3"||row.serviceDirect=="1"){
                return "呼出";
            }else{
                return "呼入";
            }
        }

        function disconnectTypeFormat(value, row, index){
            if(row.disconnectType=="1"){
                return "客户挂机";
            }else{
                return "坐席挂机";
            }
        }

        function callOperation(value, row, index){
            var array = [];
            array.push('<a class="download" href="javascript:void(0);" title="下载">');
            array.push('<i class="icon icon-download-alt"></i>');
            array.push('</a>');
            array.push('  ');
            array.push('<a class="play" href="javascript:void(0);" title="播放">');
            array.push('<i class="icon icon-headphones"></i>');
            array.push('</a>');
            return array.join('');
        }

        var operateEvents = {
            'click .download': function (e, value, row, index) {
                var url = "${fns:getConfig('call.record.default.path')}/"+"${fns:getConfig('call.server.vccid')}/"+row.filePath;
                window.open("${ctx}/call/record/recordinfo/download?filePath="+url);
            },
            'click .play': function (e, value, row, index) {
                var url = "${fns:getConfig('call.record.default.path')}/"+"${fns:getConfig('call.server.vccid')}/"+row.filePath;
                palyer(url);
            }
        };

    </script>
</body>
</html>